/**
 * 
 */
package com.gmail.blackdog1987.carcare.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import com.gmail.blackdog1987.carcare.R;
import com.gmail.blackdog1987.carcare.activity.CarChangeTypeActivity;
import com.gmail.blackdog1987.carcare.activity.CarFixTypeActivity;
import com.gmail.blackdog1987.carcare.activity.CarRentTypeActivity;
import com.gmail.blackdog1987.carcare.activity.CarSaleTypeActivity;
import com.gmail.blackdog1987.carcare.activity.CarCleanActivity;
import com.gmail.blackdog1987.carcare.activity.GasActivity;
import com.gmail.blackdog1987.carcare.activity.MeiRongActivity;
import com.gmail.blackdog1987.carcare.activity.OrderDriveCompanyActivity;
import com.gmail.blackdog1987.carcare.activity.RoadHelpTypeActivity;
import com.umeng.analytics.MobclickAgent;

/**
 * @author wdy
 *
 */
public class HomeFragment extends Fragment implements OnClickListener {
	private View mContentView;

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mContentView = inflater.inflate(R.layout.fragment_home, null);
		reg();
		return mContentView;
	};
	
	private void reg(){
		mContentView.findViewById(R.id.main_breakrule).setOnClickListener(this);
		mContentView.findViewById(R.id.main_carrent).setOnClickListener(this);
		mContentView.findViewById(R.id.main_carsale).setOnClickListener(this);
		mContentView.findViewById(R.id.main_change).setOnClickListener(this);
		mContentView.findViewById(R.id.main_clean).setOnClickListener(this);
		mContentView.findViewById(R.id.main_company).setOnClickListener(this);
		mContentView.findViewById(R.id.main_fix).setOnClickListener(this);
		mContentView.findViewById(R.id.main_gas).setOnClickListener(this);
		mContentView.findViewById(R.id.main_jiazhao).setOnClickListener(this);
		mContentView.findViewById(R.id.main_meirong).setOnClickListener(this);
		mContentView.findViewById(R.id.main_roadhelp).setOnClickListener(this);
		mContentView.findViewById(R.id.main_travle).setOnClickListener(this);
	}
	
	public void onResume() {
		super.onResume();
		MobclickAgent.onPageStart("MainScreen"); // 统计页面
	}

	public void onPause() {
		super.onPause();
		MobclickAgent.onPageEnd("MainScreen");
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.main_clean:
			startActivity(new Intent(getActivity(), CarCleanActivity.class));
			break;
		case R.id.main_meirong:
			startActivity(new Intent(getActivity(), MeiRongActivity.class));
			break;
		case R.id.main_roadhelp:
			startActivity(new Intent(getActivity(), RoadHelpTypeActivity.class));
			break;
		case R.id.main_company:
			startActivity(new Intent(getActivity(), OrderDriveCompanyActivity.class));
			break;
		case R.id.main_gas:
			startActivity(new Intent(getActivity(), GasActivity.class));
			break;
		case R.id.main_carsale:
			startActivity(new Intent(getActivity(), CarSaleTypeActivity.class));
			break;
		case R.id.main_carrent:
			startActivity(new Intent(getActivity(), CarRentTypeActivity.class));
			break;
		case R.id.main_change:
			startActivity(new Intent(getActivity(), CarChangeTypeActivity.class));
			break;
		case R.id.main_fix:
			startActivity(new Intent(getActivity(), CarFixTypeActivity.class));
			break;
		}
	}

}
